import javax.jws.soap.SOAPBinding;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2023-04-27
 * Time:21:43
 */

/**
 * BM22比较版本号
 */

public class compare {
    public static void main(String[] args) {
       String version1 = "1.1";
       String version2 = "1.1.1";
       compare(version1,version2);

    }
    /**
     * 代码中的类名、方法名、参数名已经指定，请勿修改，直接返回方法规定的值即可
     *
     * 比较版本号
     * @param version1 string字符串
     * @param version2 string字符串
     * @return int整型
     */
    public static int compare (String version1, String version2) {
        // write code here
//        StringBuilder stringBuilder1 = new StringBuilder();
//        StringBuilder stringBuilder2 = new StringBuilder();
//        stringBuilder1.append(version1);
//        stringBuilder2.append(version2);
        String[] strings1 = version1.split("\\.");
        String[] strings2 = version2.split("\\.");
        int len1 = strings1.length;
        int len2 = strings2.length;
        int i1 = 0;
        int i2 = 0;
        while (i1 < len1 || i2 < len2){
            int num1 = i1 < len1 ? Integer.parseInt(strings1[i1]) : 0;
            int num2 = i2 < len2 ? Integer.parseInt(strings2[i1]) : 0;
            if (num1 > num2){
                return 1;
            }else if (num1 < num2){
                return -1;
            }
            i1++;
            i2++;
        }
        return 0;
    }
}
